<!DOCTYPE html>
<html>
<head>
    <title>平涛</title>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="description" content="Write an awesome description for your new site here. You can edit this line in _config.yml. It will appear in your document head meta (for Google search results) and in your feed.xml site description.
">
    <script src="__PUBLIC__/Wechat/js/jquery.1.7.2.min.js"></script>
    <script src="__PUBLIC__/Wechat/js/mobiscroll_002.js" type="text/javascript"></script>
    <script src="__PUBLIC__/Wechat/js/mobiscroll_004.js" type="text/javascript"></script>
    <link href="__PUBLIC__/Wechat/css/mobiscroll_002.css" rel="stylesheet" type="text/css">
    <link href="__PUBLIC__/Wechat/css/mobiscroll.css" rel="stylesheet" type="text/css">
    <script src="__PUBLIC__/Wechat/js/mobiscroll.js" type="text/javascript"></script>
    <script src="__PUBLIC__/Wechat/js/mobiscroll_003.js" type="text/javascript"></script>
    <script src="__PUBLIC__/Wechat/js/mobiscroll_005.js" type="text/javascript"></script>
    <link href="__PUBLIC__/Wechat/css/mobiscroll_003.css" rel="stylesheet" type="text/css">

    <link rel="stylesheet" type="text/css" href="__PUBLIC__/Wechat/css/weui.min.css">
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/Wechat/css/jquery-weui.css">
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/Wechat/css/style.css">
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/Wechat/css/aui-iconfont.css">

    <style type="text/css">
        .b-t{border-bottom: 1px solid #d9d9d9;padding-top: 10px;}
        .weui_cells{margin-top: -1px !important}
        .c-ml1{margin-left: 20px !important}
        .c-r1{color: red !important}
    </style>

</head>


<body ontouchstart>

<form>
    <div class="weui_tab">
        <div class="weui_navbar weui_navbar1">
            <div class="weui_navbar_item weui_bar_item_on">
                <div style="text-align:left;float:left">
                    <a href="{:U('Client/add',array('cid'=>$cid))}">
                        <span class="aui-iconfont aui-icon-left"></span>
                    </a>
                </div>
                <span>新增负责人信息</span>
                <div class="f-r">
                    <span class="f-s1" style="cursor:pointer;color:green;" onclick="tj()">添加</span>
                    <!-- <a class="f-s1 c-r1" href="" >完成</a> -->
                </div>
            </div>
        </div>
        <div class="weui_tab_bd">
            <div class="weui_cells weui_cells_form">
                <div class="weui_cell">
                    <div class="weui_cell_hd"><label class="weui_label">姓名</label></div>
                    <div class="weui_cell_bd weui_cell_primary">
                        <input class="weui_input" type="text" name="realname" id="realname" placeholder="请输入负责人姓名">
                    </div>
                </div>
                <div class="weui_cell">
                    <div class="weui_cell_hd"><label for="" class="weui_label">生日</label></div>
                    <div class="weui_cell_bd weui_cell_primary">
                        <input class="weui_input" id="birthday" type="text" name="birthday" value="" placeholder="请选择负责人生日">
                        <!--<input class="weui_input" type="text" name="birthday" id="birthday" placeholder="请输入负责人生日">-->
                    </div>
                </div>
                <div class="weui_cell">
                    <div class="weui_cell_hd"><label for="" class="weui_label">性别</label></div>
                    <div class="weui_cell_bd weui_cell_primary">
                        <label><input class="weui_radio" type="radio" name="sex" value="1" checked> 男</label>
                        <label><input class="weui_radio c-ml1" type="radio" name="sex" id="sex" value="2"> 女</label>
                    </div>
                </div>
                <div class="weui_cell">
                    <div class="weui_cell_hd"><label for="" class="weui_label">联系方式</label></div>
                    <div class="weui_cell_bd weui_cell_primary">
                        <input class="weui_input" type="text" name="tel" id="tel" placeholder="请输入联系方式">
                    </div>
                </div> 
                <div class="weui_cell">
                    <div class="weui_cell_hd"><label for="" class="weui_label">QQ</label></div>
                    <div class="weui_cell_bd weui_cell_primary">
                        <input class="weui_input" type="text" name="qq" id="qq" placeholder="请输入QQ号">
                    </div>
                </div> 
                <div class="weui_cell">
                    <div class="weui_cell_hd"><label for="" class="weui_label">微信</label></div>
                    <div class="weui_cell_bd weui_cell_primary">
                        <input class="weui_input" type="text" name="wechat" id="wechat" placeholder="请输入微信号">
                    </div>
                </div> 
                <div class="weui_cell">
                    <div class="weui_cell_hd"><label for="" class="weui_label">Email</label></div>
                    <div class="weui_cell_bd weui_cell_primary">
                        <input class="weui_input" type="text" name="email" id="email" placeholder="请输入Email号">
                    </div>
                </div> 

            </div>
        </div>

        <include file="Index/footer" />

    </div>
</form>  

    <!--<script type="text/javascript" src="__PUBLIC__/Wechat/js/jquery-2.1.4.js"></script>-->
    <script type="text/javascript" src="__PUBLIC__/Wechat/js/fastclick.js"></script>
    <script type="text/javascript" src="__PUBLIC__/Wechat/js/jquery-weui.js"></script>
    <script type="text/javascript" src="__PUBLIC__/Wechat/layer_mobile/layer.js"></script> 
    <script>
        $(function(){
            FastClick.attach(document.body);
        });

        $(function () {
            var currYear = (new Date()).getFullYear();  
            // var currDay=new Date();
            var opt={};
            opt.date = {preset : 'date'};
            opt.datetime = {preset : 'datetime'};
            opt.time = {preset : 'time'};
            opt.default = {
                theme: 'android-ics light', //皮肤样式
                    display: 'modal', //显示方式 
                    mode: 'scroller', //日期选择模式
                dateFormat: 'yyyy-mm-dd',
                lang: 'zh',
                showNow: true,
                nowText: "今天",
                    startYear: currYear - 10, //开始年份
                    endYear: currYear + 10, //结束年份
                    
          };
    
            $("#birthday").mobiscroll($.extend(opt['date'], opt['default']));
            var optDateTime = $.extend(opt['datetime'], opt['default']);
            var optTime = $.extend(opt['time'], opt['default']);
            $("#appDateTime").mobiscroll(optDateTime).datetime(optDateTime);
            $("#appTime").mobiscroll(optTime).time(optTime);
            });
            
            

        // 添加 
        function tj(){
            if( $.trim($('#realname').val()) == '' ){ 
                layer.open({
                    content: '请先填写负责人名称',
                    skin: 'msg',
                    time: 1 ,
                });
            }else{
                $.ajax({  
                    url: "{:U('Client/contactAddCheck',array('cid'=>$cid))}", 
                    type: "POST",  
                    data: $('form').serializeArray(), 
                    success: function(msg){  
                        console.log(msg);
                        layer.open({
                            content: msg['content'],
                            skin: 'msg',
                            time: 1 ,
                        });
                        if(msg['state'] == 200){
                            setTimeout('window.location.href = "{:U('Client/add',array('cid'=>$cid))}"', 1000);
                        }
                    }  
                });
            }
        }
    </script>

</body>
</html>
